package com.cd.dao;

import com.cd.entity.Student;
import com.cd.mapper.StudentMapper;
import com.cd.util.MybatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.io.IOException;
import java.util.List;

/**
 * 类名：
 * 作者：WF
 * 功能：
 */
public class StudentDao {

	/**
	 * 1. 查询所有学生
	 * @return
	 * @throws IOException
	 */
	public List<Student> findAll() throws IOException {
		try (SqlSession session = MybatisUtil.getSqlSession(true)) {
			StudentMapper mapper = session.getMapper(StudentMapper.class);
			return mapper.findAll();
		}
	}
}
